﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Core.Domain.Values
{
	using Falcon.Core.Validation;

	public class UserProfileUpdate : ValueBase<UserProfileUpdate>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="UserProfileUpdate"/> class.
		/// </summary>
		public UserProfileUpdate()
		{
			
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="UserProfileUpdate"/> class.
		/// </summary>
		/// <param name="profile">The profile.</param>
		public UserProfileUpdate(UserProfile profile)
		{
			this.Id = profile.Id;
			this.Title = profile.Title;
			this.Homepage = profile.Homepage;
			this.Icq = profile.Icq;
			this.Aim = profile.Aim;
			this.Msn = profile.Msn;
			this.Yahoo = profile.Yahoo;
			this.Jabber = profile.Jabber;
			this.Skype = profile.Skype;
			this.Signature = profile.Signature;
		}

		/// <summary>
		/// Gets or sets the id.
		/// </summary>
		/// <value>The id.</value>
		public int Id
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the title.
		/// </summary>
		/// <value>The title.</value>
		public string Title
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the homepage.
		/// </summary>
		/// <value>The homepage.</value>
		public string Homepage
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the icq.
		/// </summary>
		/// <value>The icq.</value>
		public string Icq
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the aim.
		/// </summary>
		/// <value>The aim.</value>
		public string Aim
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the MSN.
		/// </summary>
		/// <value>The MSN.</value>
		public string Msn
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the yahoo.
		/// </summary>
		/// <value>The yahoo.</value>
		public string Yahoo
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the jabber.
		/// </summary>
		/// <value>The jabber.</value>
		public string Jabber
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the skype.
		/// </summary>
		/// <value>The skype.</value>
		public string Skype
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the signature.
		/// </summary>
		/// <value>The signature.</value>
		public string Signature
		{
			get;
			set;
		}

		/// <summary>
		/// Populates the user profile with the values.
		/// </summary>
		/// <param name="profile">The profile.</param>
		public void ToEntity(UserProfile profile)
		{
			profile.Title = this.Title;
			profile.Homepage = this.Homepage;
			profile.Icq = this.Icq;
			profile.Aim = this.Aim;
			profile.Msn = this.Msn;
			profile.Yahoo = this.Yahoo;
			profile.Jabber = this.Jabber;
			profile.Skype = this.Skype;
			profile.Signature = this.Signature;
		}

		/// <summary>
		/// Validation rules for this instance.
		/// </summary>
		/// <returns></returns>
		public override Validator<UserProfileUpdate> Rules()
		{
			return base.Rules();
		}

		/// <summary>
		/// Validates this instance.
		/// </summary>
		public override void Validate()
		{
			this.Rules().Validate(this);
		}
	}
}